<template>
  <view class="nui_data_picker_wapper">
    <view class="ndpw">
      <uni-data-picker :placeholder="placeholder" :popup-title="popupTitle" :value="value" :localdata="items" :readonly="disabled" :map="map" @change="onChange"> </uni-data-picker>
    </view>
  </view>
</template>

<script>
import { uniDataPicker } from '@dcloudio/uni-ui'

export default {
  components: {
    uniDataPicker,
  },
  props: {
    value: {
      type: [Number, String, null, undefined],
      default: 0,
    },
    items: {
      type: [Array, null],
      default: [],
    },
    popupTitle: {
      type: [String, null, undefined],
      default: '请进行选择',
    },
    placeholder: {
      type: [String, null, undefined],
      default: '请进行选择',
    },
    disabled: {
      type: [Boolean, null, undefined],
      default: false,
    },
    map: {
      default: { value: 'value', text: 'text' },
    },
  },
  methods: {
    onChange({ detail }) {
      this.$emit('update:value', detail.value)
      this.$emit('change', detail.value)
    },
  },
}
</script>

<style lang="scss" scoped>
.nui_data_picker_wapper {
  width: 100%;
  height: 100%;
  font-size: 30rpx;
  font-weight: 500;
}
</style>